﻿using Information.System.Interfaces;
using System;
using System.IO;

namespace Information.System.Tools
{
    class ToolsMain
    {

        static void Main(string[] args)
        {

            var allTables = new ToolsService().GetAllTables();
            foreach(var table in allTables)
            {
                string tablename = "";
                string header = table.Split("_")[0];
                header = header.Substring(0, 1).ToUpper() + header.Substring(1, header.Length - 1).ToLower();
                string name = table.Split("_")[1];
                name = name.Substring(0, 1).ToUpper() + name.Substring(1, name.Length - 1).ToLower();
                tablename = header + "_" + name;
                Console.Write($"生成[{ table }]表 模型: ");
                Console.WriteLine(new ToolsService().CreateModels("E:\\autoCreateCode\\Information.System.Model\\Entity", "Information.System.Model", tablename, ""));
                Console.Write($"生成[{ table }]表 服务: ");
                Console.WriteLine(new ToolsService().CreateServices("E:\\autoCreateCode\\Information.System.Interfaces\\Service", "Information.System.Interfaces", tablename));
                Console.Write($"生成[{ table }]表 接口: ");
                Console.WriteLine(new ToolsService().CreateIServices("E:\\autoCreateCode\\Information.System.Interfaces\\IService", "Information.System.Interfaces", tablename));
            }

            Console.Write($"生成DbContext: ");
            Console.WriteLine(new ToolsService().CreateDbContext("E:\\autoCreateCode\\Information.System.Core\\DbContext.cs", "Information.System.Core"));
            Console.ReadKey();
        }
    }
}
